package com.chuantou.yuba.util;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

public class FragmentUtil {

	/**
	 * 隐藏所有的fragmeng
	 * 
	 * @param manager
	 */
	public static final void hideAllFragment(FragmentManager manager) {
		List<Fragment> fragments = manager.getFragments();
		if (fragments != null && !fragments.isEmpty()) {
			FragmentTransaction transaction = manager.beginTransaction();
			for (Fragment fragment : fragments) {
				if (fragment != null) {
					transaction.hide(fragment);
				}
			}
			transaction.commitAllowingStateLoss();
		}
	}
}
